{% set pypi_name = 'python-octaviaclient' %}
{% set upstream_version = upstream_version('2.2.0') %}
{% set rpm_release = '1' %}
{% set source = url_pypi() %}

Name:           {{ py2name() }}
Version:        {{ py2rpmversion() }}
Release:        {{ py2rpmrelease() }}
Summary:        Octavia Plugin for the OpenStack Command-line Client
License:        {{ license('Apache-2.0') }}
Group:          Development/Languages/Python
URL:            https://docs.openstack.org/{{ pypi_name }}
Source0:        {{ source }}
BuildRequires:  openstack-macros
BuildRequires:  {{ py3('mock') }}
BuildRequires:  {{ py3('python-openstackclient') }}
BuildRequires:  {{ py3('oslotest') }}
BuildRequires:  {{ py3('requests-mock') }}
BuildRequires:  {{ py3('stestr') }}
BuildRequires:  {{ py3('testscenarios') }}
BuildArch:      noarch

%description
The Python Octavia Client (python-octaviaclient) is a command-line client for
the OpenStack Load Balancing service.

%package -n python3-octaviaclient
Summary:        Octavia Plugin for the OpenStack Command-line Client
Requires:       {{ py3('Babel') }}
Requires:       {{ py3('cliff') }}
Requires:       {{ py3('keystoneauth1') }}
Requires:       {{ py3('netifaces') }}
Requires:       {{ py3('python-neutronclient') }}
Requires:       {{ py3('python-openstackclient') }}
Requires:       {{ py3('osc-lib') }}
Requires:       {{ py3('oslo.serialization') }}
Requires:       {{ py3('oslo.utils') }}
Requires:       {{ py3('requests') }}
Requires:       {{ py3('six') }}

%description -n python3-octaviaclient
The Python Octavia Client (python-octaviaclient) is a command-line client for
the OpenStack Load Balancing service.

This package contains the Python 3.x module.

%package -n python-octaviaclient-doc
Summary:        Documentation for OpenStack Octavia API Client
Group:          Documentation/HTML
BuildRequires:  {{ py3('Sphinx') }}
BuildRequires:  {{ py3('openstackdocstheme') }}
BuildRequires:  {{ py3('reno') }}
BuildRequires:  {{ py3('sphinxcontrib-svg2pdfconverter') }}

%description -n python-octaviaclient-doc
The Python Octavia Client (python-octaviaclient) is a command-line client for
the OpenStack Load Balancing service.
This package contains auto-generated documentation.

%prep
%autosetup -p1 -n {{ pypi_name }}-{{ upstream_version }}
%py_req_cleanup

%build
%{py3_build}

PBR_VERSION={{ upstream_version }} %sphinx_build -b html doc/source doc/build/html
# remove the sphinx-build leftovers
rm -rf doc/build/html/.{doctrees,buildinfo}

%install
%{py3_install}

%check
# we don't want hacking
rm -f octaviaclient/tests/unit/test_hacking.py
python3 -m stestr.cli run

%files -n python3-octaviaclient
%doc README.rst
%license LICENSE
%{python3_sitelib}/octaviaclient
%{python3_sitelib}/*.egg-info

%files -n python-octaviaclient-doc
%license LICENSE
%doc doc/build/html

%changelog
